<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增品牌')"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-brand-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">名称：</label>
            <div class="col-sm-8">
                <input name="name" class="form-control" type="text">
            </div>
        </div>
        <!--<div class="form-group">-->
            <!--<label class="col-sm-3 control-label">多级联动：</label>-->
            <!--<div class="col-sm-8">-->
                <!--<input type="hidden" name="category_id" id="category_id" value=""/>-->
                <!--<div class="dropdown">-->
                    <!--<a id="dLabel" role="button" data-toggle="dropdown" class="btn btn-white" data-target="#"-->
                       <!--href="javascript:;"><span id="select-title">选择分类</span> <span class="caret"></span></a>-->
                    <!--<ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">-->
                        <!--<li><a href="javascript:;" data-index="1" data-title="一级菜单">一级菜单</a></li>-->
                        <!--<li class="dropdown-submenu">-->
                            <!--<a href="javascript:;" data-index="2" data-title="一级菜单">一级菜单</a>-->
                            <!--<ul class="dropdown-menu">-->
                                <!--<li><a data-index="2-1" href="javascript:;" data-title="二级菜单">二级菜单</a></li>-->
                            <!--</ul>-->
                        <!--</li>-->
                        <!--<li class="dropdown-submenu">-->
                            <!--<a tabindex="3" href="javascript:;" data-title="一级菜单">一级菜单</a>-->
                            <!--<ul class="dropdown-menu">-->
                                <!--<li><a tabindex="3-1" href="javascript:;" data-title="二级菜单">二级菜单</a></li>-->
                                <!--<li class="divider"></li>-->
                                <!--<li class="dropdown-submenu">-->
                                    <!--<a href="javascript:;" data-index="3-2" data-title="二级菜单">二级菜单</a>-->
                                    <!--<ul class="dropdown-menu">-->
                                        <!--<li><a href="javascript:;" data-index="3-2-1" data-title="三级菜单">三级菜单</a></li>-->
                                    <!--</ul>-->
                                <!--</li>-->
                            <!--</ul>-->
                        <!--</li>-->
                    <!--</ul>-->
                <!--</div>-->

            <!--</div>-->
        <!--</div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">首字母：</label>
            <div class="col-sm-8">
                <input name="firstLetter" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">排序：</label>
            <div class="col-sm-8">
                <input name="sort" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">显示状态</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('brand_show_status')}">
                    <input type="radio" th:id="${dict.dictCode}" name="showStatus" th:value="${dict.dictValue}">
                    <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">品牌logo</label>
            <input name="logo" type="hidden">
            <div class="col-sm-8">
                <div class="file-loading">
                    <input name="file" id="fileinput-demo-1" type="file" multiple>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">品牌故事：</label>
            <div class="col-sm-8">
                <input name="brandStory" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script type="text/javascript">
    var prefix = ctx + "mall/brand"
    $("#form-brand-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-brand-add').serialize());
        }
    }

    $("#fileinput-demo-1").fileinput({
        'theme': 'explorer-fas',
        'uploadUrl': ctx + 'aliyun/upload',
        overwriteInitial: false,
        autoReplace: true,
        initialPreviewAsData: true,
        initialPreview: [//初始显示图片列表
        ]
    }).on("fileuploaded", function (event, data, previewId, index) {//上传成功回调
        console.log(data.response);
        $("input[name='logo']").val(data.response.url);
    });

    $('.dropdown li a').click(function () {
        console.log(this);
        title = $(this).attr("data-title");
        id = $(this).attr("data-index");
        $("#select-title").text(title);
        $("#category_id").val(id);
    })
</script>
</body>
</html>